package com.wsx.ones.boots.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType;
import org.springframework.http.converter.protobuf.ProtobufHttpMessageConverter;

import java.util.ArrayList;
import java.util.List;

/**
 * @author wangshuaixin
 * @Title: com.wsx.ones.boots.config.CodeConfig
 * @Description: TODO
 * @date 2019/04/27
 */
@Configuration
public class ProtoCodeConfig {


    @Bean
    public ProtobufHttpMessageConverter protobufHttpMessageConverter() {
        ProtobufHttpMessageConverter converter = new ProtobufHttpMessageConverter();
        List<MediaType> types = new ArrayList<>(3);
        types.add(MediaType.valueOf("application/x-protobuf"));
        converter.setSupportedMediaTypes(types);
        return converter;
    }
}
